package pattern.strategy.discount;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

// 会员卡容器类
public class VipCardFactory {
    private static Map<String, VipCard> map = new ConcurrentHashMap<>();

    static {
        map.put("gold", new GoldCard());
        map.put("silver", new SilverCard());
        map.put("copper", new CopperCard());
    }
    public static VipCard getVipCard(String level) {
        return map.get(level) == null ? new Normal() : map.get(level);
    }
}
